package com.yuelife.service.impl;

import com.yuelife.dao.HelpsendorderDao;
import com.yuelife.dto.IdDTO;
import com.yuelife.dto.SendOrderDTO;
import com.yuelife.pojo.Helpsendorder;
import com.yuelife.service.HelpSendOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author by Rxzeg
 * @date 2020-07-02 11:50
 * @describe
 */
@Service
public class HelpSendOrderServiceImpl implements HelpSendOrderService {
    private int d_id;
    public int getD_id() {
        return d_id;
    }
    public void setD_id(int d_id) {
        this.d_id = d_id;
    }
    private int s_id;
    public int getS_id() {
        return s_id;
    }
    public void setS_id(int s_id) {
        this.s_id = s_id;
    }
    @Autowired
    private HelpsendorderDao helpsendorderDao;
    @Override
    public void add(SendOrderDTO sendOrderDTO, String order_id, IdDTO idDTO) {
        Helpsendorder hp=new Helpsendorder();
        hp.setCreatedtime(new Date());
        hp.setCustomerid(sendOrderDTO.getCustomerid());
        hp.setEstimatetime(sendOrderDTO.getEstimatetime());
        hp.setGetadressId(sendOrderDTO.getGetadressId());
        hp.setHelpbuyorderno(order_id);
        hp.setPickuptime(sendOrderDTO.getPickuptime());
        hp.setRelatedadressId(sendOrderDTO.getRelatedadressId());
        hp.setRemark(sendOrderDTO.getRemark());
        hp.setServiceprice(sendOrderDTO.getServiceprice());
        hp.setStatus(1);
        hp.setGoodid(idDTO.getD_id());//商品id
        hp.setSendpricedetailId(idDTO.getS_id());//配送费明细id
        helpsendorderDao.insert(hp);
    }

    @Override
    public List<Helpsendorder> getAllOrder() {
      return   helpsendorderDao.selectAll();
    }
}
